package test;
import java.awt.image.AreaAveragingScaleFilter;
import java.util.ArrayList;
import java.util.Scanner;
public class CreatFormula {
	public static void main(String[] args){
		ArrayList<String> list=new ArrayList<>();
		Scanner scanner =new Scanner(System.in);
		int formulanum=scanner.nextInt();
		while(formulanum!=0){                     
			int number=(int) (Math.random()*3+2); //取数字2-4个
			int bracket=(int) (Math.random()*2);  //0表示不加括号，1表示加括号
			int left,right=0;
			if(number!=2&&bracket==1){
				left=(int) (Math.random()*(number-1)+1);     //表示左括号在第几个数前
				if(left==1){
					//不允许出现类似（1+9+8+5）这种没有意义的括号
				    right=((int) (Math.random()*(number-2)+left+1));
				}else{   //表示
					right=((int) (Math.random()*(number+1-left)+left));
				}
			}
			// int right=                                    //表示右括号在第几个数后
			System.out.println("   "+number);
			boolean hasSqure=false;
			list.add((int) (Math.random()*100)+"");
			for(int i=1;i<number;i++){
				switch((int) (Math.random()*5)){
					case 0:
						list.add("+");
						break;
					case 1:
						list.add("-");
						break;
					case 2:
						list.add("*");
						break;
					case 3:
						list.add("/");
						break;
					case 4:
						list.add("^"+((int)(Math.random()*2+2))+"");
						i--;
						hasSqure=true;
						break;
				}
				if(hasSqure){
					hasSqure=false;
					continue;
				}
				list.add((int) (Math.random()*100)+"");
			}
			while(!list.isEmpty()){
				System.out.print(list.get(0));
				list.remove(0);
			}
			System.out.println();
			formulanum--;
		}	
	}
}
